<template>
  <view class="message-card">
    <view class="card-header">
      <view class="card-title">{{ homework.subject }}</view>
      <view class="card-subtitle">教师: {{ homework.teacherName }}</view>
    </view>
    <view class="card-content">
      <view class="content-item">
        <text class="item-label">时间:</text>
        <text class="item-value">{{ homework.workDate }}</text>
      </view>
      <view class="content-item">
        <text class="item-label">内容:</text>
        <text class="item-value">{{ homework.homework }}</text>
      </view>
    </view>
  </view>
</template>

<script setup lang="ts">
import { defineProps } from 'vue'
import type { HomeworkItem } from '@/types/homework'

defineProps<{
  homework: HomeworkItem
}>()
</script>
<style scoped lang="scss">
.message-card {
  background-color: $homework-card-bg;
  border-radius: $homework-card-radius;
  box-shadow: $homework-card-shadow;
  margin: 20rpx;
  overflow: hidden;
  transition: all 0.3s ease;
}

.message-card:active {
  transform: scale(0.98);
  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
}

.card-header {
  padding: 30rpx 30rpx 20rpx;
  background-color: #f8fafc;
  border-bottom: 1rpx solid #f0f2f5;
}

.card-title {
  font-size: 36rpx;
  font-weight: bold;
  color: $homework-text-main;
  margin-bottom: 10rpx;
}

.card-subtitle {
  font-size: 28rpx;
  color: $homework-text-secondary;
}

.card-content {
  padding: 25rpx 30rpx;
}

.content-item {
  display: flex;
  margin-bottom: 20rpx;
  align-items: flex-start;
}

.content-item:last-child {
  margin-bottom: 0;
}

.item-label {
  width: 180rpx;
  font-size: 28rpx;
  color: $homework-text-auxiliary;
  flex-shrink: 0;
}

.item-value {
  flex: 1;
  font-size: 28rpx;
  color: $homework-text-main;
  line-height: 1.5;
  word-break: break-all;
}

.comment-item {
  align-items: flex-start; /* 让老师点评内容与标签顶部对齐 */
}

.comment-item .item-value {
  min-height: 80rpx;
}

.card-footer {
  display: flex;
  justify-content: flex-end; /* 让分数在最右侧展示 */
  align-items: center;
  padding: 20rpx 30rpx;
  background-color: #f8fafc;
  border-top: 1rpx solid #f0f2f5;
}

.score-badge {
  background-color: #e6f7f0;
  color: $homework-secondary-color;
  padding: 8rpx 16rpx;
  border-radius: 20rpx;
  font-size: 26rpx;
}
</style>
